<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>  
    <title>用户注册</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<link rel="stylesheet" href="../css/vip.css" type="text/css">
    <script language=JavaScript src="../js/FoshanRen.js"></script>
    <script language=JavaScript src="../js/calendar.js"></script>
    <script type="text/javascript" src="../js/showNewDiv.js"></script>
    <link rel="stylesheet" type="text/css" href="../js/extjs/resources/css/ext-all.css"/>
   <script type="text/javascript" charset="utf-8" src="../js/extjs/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/extjs/ext-all.js"></script>
    <script language="javascript">
    function len(s){//获取字符串的字节长度
  return s.length+(s.match(/[^\x00-\xff]/g) ||"").length;//加上匹配到的全角字符长度
}

function check2(){
var reg=/^\\d+$/;//判断是正整数的正则表达式
var LEN_TITLE=40,LEN_NUM=4;
var usrName,password1,realName;
userName=document.getElementById("userName").value;
if(userName==""){
  alert("用户名不可为空！");
  return;
}
if(len(userName)>LEN_TITLE){
  alert("用户名长度超过"+LEN_TITLE+"字节！");
  return;
}
password1=document.getElementById("password1").value;
if(password1==""){
  alert("密码不可为空！");
  return;
}
if(len(password1)>LEN_TITLE){
  alert("密码长度超过"+LEN_TITLE+"字节！");
  return;
}
realName=document.getElementById("realName").value;
if(realName==""){
  alert("真实姓名不可为空！");
  return;
}
if(len(realName)>LEN_TITLE){
  alert("真实姓名长度超过"+LEN_TITLE+"字节！");
  return;
}
password2=document.getElementById("password2").value;
   	if(password2==""){
   	  alert("请输入确认密码！");
   	  return;
   	  }
   	checkPassword();
}
   
    function checkPassword()
   {   var pw1,pw2,f;
       pw1=document.getElementById("password1").value;
       pw2=document.getElementById("password2").value;
       f=document.getElementById("myform");
       if(pw1==pw2) {
          f.submit();
          return ;
          }
       alert("两次输入密码不一致！");
       return false;
    }
</script> 
   <s:head theme="xhtml"/>
   <sx:head parseContent="true"/>
</head> 
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  <s:form id="myform" action="user_save" namespace="/admin/user" enctype="multipart/form-data"  method="post">
  <s:hidden name="typeid"/>
  <table id="tables" width="98%" border="0" cellspacing="1" cellpadding="3" align="center">
    <tr bgcolor="6f8ac4"> 
      <td colspan="2" ><font color="#FFFFFF">用户注册：</font></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">用户名  ：</div></td>
      <td width="75%"><s:textfield id="userName" name="user.userName"/><font color="#FF0000">*</font></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">密码  ：</div></td>
      <td width="75%"><s:password id="password1" name="user.password"/><font color="#FF0000">*</font></td>
    </tr>
     <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">密码确认  ：</div></td>
      <td width="75%"><s:password id="password2"/><font color="#FF0000">*</font></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">真实姓名 ：</div></td>
      <td width="75%"><s:textfield id="realName" name="user.realName"/><font color="#FF0000">*</font></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">用户类型 ：</div></td>
      <td width="75%">
      <s:select id="userType" name="user.userType" list="#{'COMMENUSER':'一般用户','ADMINISTRATOR':'管理员','SENIORUSER':'高级用户'}"/></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td colspan="2"> <div align="center"> 
          <input type="button" class="frm_btn" value="提交" onclick="check2()">
          &nbsp;&nbsp;<input type="button" name="Button" value=" 返 回 " class="frm_btn" onclick="javascript:history.back()">
        </div></td>
    </tr>
  </table>
</s:form>
</body>
</html>